<template>
	<view class="mainpadding2">
		<view class="xiahuaxian margin_top" v-for="item in list.data" :key="item.id">
			<view class="flexbetween">
				<view class="titletext xiaohei fonweight">提现到{{returnType(item.type)}}</view>
				<view class="titletext xiaohuang fonweight">￥{{item.withdrawal_price}}</view>
			</view>
			<view class="flexbetween margin_top2">
				<view class="ershil xiaohui">{{item.createtime_text}}</view>
				<view class="ershil xiaohui" v-if="item.status==1">提现成功</view>
				<view class="ershil xiaohong" v-if="item.status==2">已驳回</view>
				<view class="ershil xiaohuang" v-if="item.status==0">待审核</view>
			</view>
			<view class="xiaohui ershil margin_top2" v-if="item.remarks">备注：{{item.remarks}}</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				page: 1,
				limit: 12,
				list: {
					data: []
				},
			}
		},
		onShow() {
			this.init()
		},
		methods: {
			returnType(val){
				// 提现方式:1=微信.2=支付宝,3=银行卡
				if(val==1) return "微信"
				if(val==2) return "支付宝"
				if(val==3) return "银行卡"
			},
			init(isPage, page) {
				let _this = this
				let url = "/api/user/getWithdrawalList"
				let data = {
					page: page || 1,
					limit: _this.limit,
				}
				httpRequest.request(url, 'GET', data, false, false, true).then(res => {
					if (res.code == 1) {
						let resList = res.data;
						let dataList = _this.list;
						if (isPage == true) {
							_this.list.data = dataList.data.concat(resList.data);
						} else {
							this.list = res.data
							_this.list.data = resList.data;
						}
					}
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
			onReachBottom() {
				let _this = this;
				let list = _this.list;
				let page = _this.page;
				if (list.last_page <= page) {
					return false;
				}
				page++;
				_this.page = page;
				_this.init(true, page);
			},
		}
	}
</script>

<style>

</style>
